﻿using Microsoft.Extensions.DependencyInjection;
using Modules.BankSpecialAccount.Entitys;
using PmSoft;
using PmSoft.ApplicationContext;
using PmSoft.DBContext;
using PmSoft.Repositories;

namespace Modules.BankSpecialAccount.Repositories;

/// <summary>
/// 专户代发批次表仓储
/// </summary>
[UseDI(ServiceLifetime.Scoped)]
public class BankSpecialAccountBatchRepository : Repository<BankSpecialAccountBatchInfo, DefaultDbContext>
{
    public BankSpecialAccountBatchRepository(DefaultDbContext dbContext, IApplicationContext applicationContext) : base(dbContext, applicationContext)
    {
    }

    /// <summary>
    /// 是否存在对应的代发批次
    /// </summary>
    /// <param name="bankAccount"></param>
    /// <param name="batchSerial"></param>
    /// <returns></returns>
    public bool ExistBatchDetail(string bankAccount, string batchSerial)
    {
        return DbContext.Exists<BankSpecialAccountBatchInfo>("bank_account =@0 and batch_serial=@1 ", bankAccount, batchSerial);
    }
}